import Vue from 'vue';
import App from './App';
Vue.config.productionTip = false;
App.mpType = 'app';
// 此处为演示Vue.prototype使用，非uView的功能部分
Vue.prototype.vuePrototype = '枣红';
// 引入全局uView
import uView from 'uview-ui';
import BaseAd from './components/base-ad.vue'
Vue.component('base-ad',BaseAd)

Vue.use(uView);
// 此处为演示vuex使用，非uView的功能部分
import store from '@/store';
// 引入uView提供的对vuex的简写法文件
let vuexStore = require('@/store/$u.mixin.js');
Vue.mixin(vuexStore);
// 引入uView对小程序分享的mixin封装
let mpShare = require('uview-ui/libs/mixin/mpShare.js');
Vue.mixin(mpShare);
import * as API from './config/api.js'
import * as index from './config/index.js'

import {
	URL
} from './config/config.js'
Vue.prototype.$url = URL
Vue.prototype.$api = API
Vue.prototype.$index = index
// uview按钮的公共样式
import styleCls from 'static/common/js/styleCls.js'
Vue.prototype.$styleCls = styleCls
import list from 'static/common/js/list.js'
Vue.prototype.$list = list
import com from 'static/common/js/common.js'
Vue.prototype.$com = com
import pTime from 'static/common/js/pickerTime.js'
Vue.prototype.$pTime = pTime
import material from 'static/common/js/material.js'
Vue.prototype.$material = material
import appShare from 'static/common/js/appShare.js'
Vue.prototype.$appShare = appShare
import wxLogin from 'static/common/js/wxLogin.js'
Vue.prototype.$wxLogin = wxLogin
import update from 'static/common/js/update.js'
Vue.prototype.$update = update
import comApi from 'common/apiUrl.js'
Vue.prototype.imgUrl = function(img) {
	return `${comApi.apiUrl.split('index.php')[0]}wxImg/${img}`
}
Vue.prototype.goTab = function(url) {
	uni.switchTab({
		url
	})
}
Vue.prototype.goBack = function() {
	uni.navigateBack()
}
const app = new Vue({
	store,
	...App
});
// http拦截器，将此部分放在new Vue()和app.$mount()之间，才能App.vue中正常使用
import httpInterceptor from '@/common/http.interceptor.js';
Vue.use(httpInterceptor, app);
// http接口API抽离，免于写url或者一些固定的参数
import httpApi from '@/common/http.api.js';
Vue.use(httpApi, app);
app.$mount();